Skip to content

Conversation

@byian
Copy link
Contributor

@byian byian commented Nov 25, 2024

This PR introduces striping of ANSI symbols for GitHub step Summary and improves the current one for PR comments.

To resolve #1248

This is similar to #1231, but uses a slightly different approach. Instead of converting ANSI symbols to html tags (using the ansi-to-html package), which results in \x1b[30mblack becoming <span style="color:#000">black</span>, we simply remove them using a regular expression, which results in \x1b[30mblack becoming just black.

The reason is that neither the Summary nor the PR comment is able to actually render the <span style="color:#000"> block with color. However, all these html tags consume limits for PR comment length and Summary size.

Fixes #1387

@byian byian requested a review from a team as a code owner November 25, 2024 16:40
@byian
Copy link
Contributor Author

byian commented Dec 2, 2024

Hi @tgummerer, do you by any chance have time to take a look at this PR?

@byian byian closed this Apr 10, 2025
@byian byian reopened this Apr 10, 2025
@byian
Copy link
Contributor Author

byian commented Apr 10, 2025

Hi all
I updated this PR, and I'm still waiting for review.

This one contains some real QoL improvements

@byian byian changed the title Remove ANSI control chars from GitHub step Summary and PR comment feat: Remove ANSI control chars from GitHub step Summary and PR comment Apr 10, 2025
import * as core from '@actions/core';
import { Config } from '../config';

function trimOutput(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why trimOutput here and in pr.ts? Looks like one of these should be removed they're doing the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, they do the same thing, yes, they trim the input string to the desired format, but for pr and summary, the formats are different.
Summary has a limit on the maximum message size in bytes, and pr has a limit on the maximum length in characters.
Maybe I should use the different names to avoid confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, ready for re-review

Copy link
Contributor

@tgummerer tgummerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about dropping the ball on this, and taking so long to review it. This PR looks good to me now, I'm gonna get it merged.

@tgummerer tgummerer merged commit 18db25e into pulumi:main Sep 29, 2025
76 checks passed
@pulumi-bot
Copy link

This PR has been shipped in release v6.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

comment trim on long output not working Colors code on summary should not be printed

4 participants